﻿namespace Gmantis.Uploader
{
    public class UploadFilePartInfo
    {
        // Fields
        private byte[] _data;
        private string _name;
        private int _partCount;
        private int _partNumber;

        // Methods
        public UploadFilePartInfo(UploadFileInfo file)
        {
            byte[] buffer = new byte[file.File.Length];
            file.File.Read(buffer, 0, buffer.Length);
            this._data = buffer;
            this._name = file.Name;
            this._partCount = 1;
            this._partNumber = 1;
        }

        public UploadFilePartInfo(string filePartName, byte[] filePartData, int partNumber, int partCount)
        {
            this._data = filePartData;
            this._name = filePartName;
            this._partCount = partCount;
            this._partNumber = partNumber;
        }

        public long GetSize()
        {
            return (long)this._data.Length;
        }

        // Properties
        public byte[] Data
        {
            get
            {
                return this._data;
            }
        }

        public string Name
        {
            get
            {
                return this._name;
            }
        }

        public int PartCount
        {
            get
            {
                return this._partCount;
            }
        }

        public int PartNumber
        {
            get
            {
                return this._partNumber;
            }
        }
    }
}
